<template>
  <div>
    <div style="display: flex;align-items: center;justify-content: center;">
      <el-card style="width: 80%;margin-top: 30px">
        <div style="margin-bottom: 10px;margin-left:5px;font-size: 20px;font-weight: bold;">用户信息</div>
        <div style="margin-bottom: 10px">
        </div>
        <el-table :data="userData" stripe
                  :header-cell-style="{backgroundColor:'aliceblue',color:'#666'}">
          <el-table-column prop="user_id" label="用户id"></el-table-column>
          <el-table-column prop="username" label="账号"></el-table-column>
          <el-table-column prop="password" label="密码"></el-table-column>
          <el-table-column prop="name" label="姓名"></el-table-column>
          <el-table-column prop="gender" label="性别"></el-table-column>
          <el-table-column prop="birthday" label="生日"></el-table-column>
          <el-table-column prop="wallet" label="钱包"></el-table-column>
          <el-table-column prop="point" label="积分"></el-table-column>
        </el-table>
        <div style="margin: 10px 0">
          <el-pagination
              @current-change="handleCurrentChange"
              :current-page="pageNum"
              :page-sizes="[100, 200, 300, 400]"
              :page-size="pageSize"
              layout="total,  prev, pager, next"
              :total="total">
          </el-pagination>
        </div>
      </el-card>
    </div>

  </div>
</template>
<script>
export default {
  name: "comment",
  data() {
    return {
      user: JSON.parse(localStorage.getItem('user') || '{}'),
      pageNum: 1,
      pageSize: 5,
      total: 0,
      userData: [],
    }
  },
  methods: {
    load(pageNum) {
      if (pageNum) this.pageNum = pageNum
      console.log("this.pageSize",this.pageSize)
      console.log("this.pageNum",this.pageNum)
      this.$request.post('/user_info_list/', {
        "page_size": this.pageSize,
        "page_id": this.pageNum,
      }).then(res => {
        if (res.code === '200') {
          this.userData = res.data.userinfo_list
          this.total = res.data.item_amount
          console.log("this.userData",res.data)
        } else if (res.code === '501') {
          console.log("this.userData2",this.userData)
        } else {
          console.log("this.userData3",this.userData)
          this.$message.error(res.msg)
        }
      })
    },
    handleCurrentChange(pageNum) {
      this.load(pageNum)
    },
    reset() {
      this.load()
    },
  },
  created() {
    this.load()
  },
}
</script>
<style scoped>
  /deep/ input::-webkit-outer-spin-button,
  /deep/ input::-webkit-inner-spin-button {
      -webkit-appearance: none;
  }
  /deep/ input[type="number"] {
      -moz-appearance: textfield;
  }
  /deep/ inpit {
      border: none
  }
</style>